package com.ruoyi.cms.service.impl;

import com.ruoyi.cms.domain.CmsFeedback;
import com.ruoyi.cms.mapper.CmsFeedbackMapper;
import com.ruoyi.cms.service.ICmsFeedbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 在线留言反馈Service业务层处理
 *
 * @author houyong
 * @date 2025-11-18
 */
@Service
public class CmsFeedbackServiceImpl implements ICmsFeedbackService {
    @Autowired
    private CmsFeedbackMapper cmsFeedbackMapper;

    /**
     * 查询在线留言反馈
     *
     * @param id 在线留言反馈主键
     * @return 在线留言反馈
     */
    @Override
    public CmsFeedback selectCmsFeedbackById(Long id) {
        return cmsFeedbackMapper.selectCmsFeedbackById(id);
    }

    /**
     * 查询在线留言反馈列表
     *
     * @param cmsFeedback 在线留言反馈
     * @return 在线留言反馈
     */
    @Override
    public List<CmsFeedback> selectCmsFeedbackList(CmsFeedback cmsFeedback) {
        return cmsFeedbackMapper.selectCmsFeedbackList(cmsFeedback);
    }

    /**
     * 新增在线留言反馈
     *
     * @param cmsFeedback 在线留言反馈
     * @return 结果
     */
    @Override
    public int insertCmsFeedback(CmsFeedback cmsFeedback) {
        cmsFeedback.setCreateTime(new Date());
        return cmsFeedbackMapper.insertCmsFeedback(cmsFeedback);
    }

    /**
     * 修改在线留言反馈
     *
     * @param cmsFeedback 在线留言反馈
     * @return 结果
     */
    @Override
    public int updateCmsFeedback(CmsFeedback cmsFeedback) {
        cmsFeedback.setUpdateTime(new Date());
        return cmsFeedbackMapper.updateCmsFeedback(cmsFeedback);
    }

    /**
     * 批量删除在线留言反馈
     *
     * @param ids 需要删除的在线留言反馈主键
     * @return 结果
     */
    @Override
    public int deleteCmsFeedbackByIds(Long[] ids, String userName, Date date) {
        return cmsFeedbackMapper.deleteCmsFeedbackByIds(ids, userName, date);
    }

    /**
     * 删除在线留言反馈信息
     *
     * @param id 在线留言反馈主键
     * @return 结果
     */
    @Override
    public int deleteCmsFeedbackById(Long id) {
        return cmsFeedbackMapper.deleteCmsFeedbackById(id);
    }

    @Override
    public int updateStatus(Long id, String userName, Date date) {
        return cmsFeedbackMapper.updateStatus(id, userName, date);
    }
}